package com.qiang.test01;

import java.io.*;



public class Demo12 {
    public static void main(String[] args) throws IOException {
        /*
        字节缓冲流构造方法

        不能直接new
         */
        BufferedOutputStream bo1 = new BufferedOutputStream(new FileOutputStream("day12\\nos.txt"));
        //写数据
        bo1.write("hello\r\n".getBytes());
        bo1.write("world\r\n".getBytes());
        //释放资源
        bo1.close();

        //输入流，读取
        BufferedInputStream bo2 = new BufferedInputStream(new FileInputStream("day12\\nos.txt"));
        byte[] bb = new byte[1024];
        int read = bo2.read(bb);
        while (read != -1) {
            String s = new String(bb, 0, read);
            System.out.println(s);
            read = bo2.read(bb);
        }
    }
}
